1   /*
2    * Copyright (c) 2001, 2005, Oracle and/or its affiliates. All rights reserved.
3    * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4    *
5    * This code is free software; you can redistribute it and/or modify it
6    * under the terms of the GNU General Public License version 2 only, as
7    * published by the Free Software Foundation.  Oracle designates this
8    * particular file as subject to the "Classpath" exception as provided
9    * by Oracle in the LICENSE file that accompanied this code.
10   *
11   * This code is distributed in the hope that it will be useful, but WITHOUT
12   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13   * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14   * version 2 for more details (a copy is included in the LICENSE file that
15   * accompanied this code).
16   *
17   * You should have received a copy of the GNU General Public License version
18   * 2 along with this work; if not, write to the Free Software Foundation,
19   * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20   *
21   * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22   * or visit www.oracle.com if you need additional information or have any
23   * questions.
24   */
25  
26  package com.sun.imageio.plugins.jpeg;
27  
28  import java.util.ListResourceBundle;
29  
30  public class JPEGImageMetadataFormatResources
31         extends JPEGMetadataFormatResources {
32  
33      static final Object[][] imageContents = {
34          // Node name, followed by description
35          { "JPEGvariety", "A node grouping all marker segments specific to the variety of stream being read/written (e.g. JFIF) - may be empty" },
36          { "markerSequence", "A node grouping all non-jfif marker segments" },
37          { "app0jfif", "A JFIF APP0 marker segment" },
38          { "app14Adobe", "An Adobe APP14 marker segment" },
39          { "sof", "A Start Of Frame marker segment" },
40          { "sos", "A Start Of Scan marker segment" },
41          { "app0JFXX", "A JFIF extension marker segment" },
42          { "app2ICC", "An ICC profile APP2 marker segment" },
43          { "JFIFthumbJPEG",
44            "A JFIF thumbnail in JPEG format (no JFIF segments permitted)" },
45          { "JFIFthumbPalette", "A JFIF thumbnail as an RGB indexed image" },
46          { "JFIFthumbRGB", "A JFIF thumbnail as an RGB image" },
47          { "componentSpec", "A component specification for a frame" },
48          { "scanComponentSpec", "A component specification for a scan" },
49  
50          // Node name + "/" + AttributeName, followed by description
51          { "app0JFIF/majorVersion",
52            "The major JFIF version number" },
53          { "app0JFIF/minorVersion",
54            "The minor JFIF version number" },
55          { "app0JFIF/resUnits",
56            "The resolution units for Xdensity and Ydensity "
57            + "(0 = no units, just aspect ratio; 1 = dots/inch; 2 = dots/cm)" },
58          { "app0JFIF/Xdensity",
59            "The horizontal density or aspect ratio numerator" },
60          { "app0JFIF/Ydensity",
61            "The vertical density or aspect ratio denominator" },
62          { "app0JFIF/thumbWidth",
63            "The width of the thumbnail, or 0 if there isn't one" },
64          { "app0JFIF/thumbHeight",
65            "The height of the thumbnail, or 0 if there isn't one" },
66          { "app0JFXX/extensionCode",
67            "The JFXX extension code identifying thumbnail type: "
68            + "(16 = JPEG, 17 = indexed, 19 = RGB" },
69          { "JFIFthumbPalette/thumbWidth",
70            "The width of the thumbnail" },
71          { "JFIFthumbPalette/thumbHeight",
72            "The height of the thumbnail" },
73          { "JFIFthumbRGB/thumbWidth",
74            "The width of the thumbnail" },
75          { "JFIFthumbRGB/thumbHeight",
76            "The height of the thumbnail" },
77          { "app14Adobe/version",
78            "The version of Adobe APP14 marker segment" },
79          { "app14Adobe/flags0",
80            "The flags0 variable of an APP14 marker segment" },
81          { "app14Adobe/flags1",
82            "The flags1 variable of an APP14 marker segment" },
83          { "app14Adobe/transform",
84            "The color transform applied to the image "
85            + "(0 = Unknown, 1 = YCbCr, 2 = YCCK)" },
86          { "sof/process",
87            "The JPEG process (0 = Baseline sequential, "
88            + "1 = Extended sequential, 2 = Progressive)" },
89          { "sof/samplePrecision",
90            "The number of bits per sample" },
91          { "sof/numLines",
92            "The number of lines in the image" },
93          { "sof/samplesPerLine",
94            "The number of samples per line" },
95          { "sof/numFrameComponents",
96            "The number of components in the image" },
97          { "componentSpec/componentId",
98            "The id for this component" },
99          { "componentSpec/HsamplingFactor",
100           "The horizontal sampling factor for this component" },
101         { "componentSpec/VsamplingFactor",
102           "The vertical sampling factor for this component" },
103         { "componentSpec/QtableSelector",
104           "The quantization table to use for this component" },
105         { "sos/numScanComponents",
106           "The number of components in the scan" },
107         { "sos/startSpectralSelection",
108           "The first spectral band included in this scan" },
109         { "sos/endSpectralSelection",
110           "The last spectral band included in this scan" },
111         { "sos/approxHigh",
112           "The highest bit position included in this scan" },
113         { "sos/approxLow",
114           "The lowest bit position included in this scan" },
115         { "scanComponentSpec/componentSelector",
116           "The id of this component" },
117         { "scanComponentSpec/dcHuffTable",
118           "The huffman table to use for encoding DC coefficients" },
119         { "scanComponentSpec/acHuffTable",
120           "The huffman table to use for encoding AC coefficients" }
121     };
122 
123     public JPEGImageMetadataFormatResources() {}
124 
125     protected Object[][] getContents() {
126         // return a copy of the combined commonContents and imageContents;
127         // in theory we want a deep clone of the combined arrays,
128         // but since it only contains (immutable) Strings, this shallow
129         // copy is sufficient
130         Object[][] combinedContents =
131             new Object[commonContents.length + imageContents.length][2];
132         int combined = 0;
133         for (int i = 0; i < commonContents.length; i++, combined++) {
134             combinedContents[combined][0] = commonContents[i][0];
135             combinedContents[combined][1] = commonContents[i][1];
136         }
137         for (int i = 0; i < imageContents.length; i++, combined++) {
138             combinedContents[combined][0] = imageContents[i][0];
139             combinedContents[combined][1] = imageContents[i][1];
140         }
141         return combinedContents;
142     }
143 }